import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

// 解决element-ui导航栏重复点击报错
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
	return originalPush.call(this, location).catch(err => err)
}

export default new Router({
  routes: [
  	{
      path: '/',
      component: () => import('@/views/main'),
      children: [
			  {
		      path: '/',
		      name: 'overview',
		      component: () => import('@/views/Overview/overview')
			  },
			  {
		      path: '/calendar',
		      name: 'calendar',
		      component: () => import('@/views/Calendar/calendar')
			  },
			  {
		      path: '/project',
		      name: 'project',
		      component: () => import('@/views/Project/project')
			  },
        {
          path: '/project/flow',
          name: 'flow',
          component: () => import('@/views/Project/flow')
        },
        {
          path: '/project/detail',
          name: 'proDetail',
          component: () => import('@/views/Project/proDetail')
        },
			  {
		      path: '/employee',
		      name: 'employee',
		      component: () => import('@/views/Employee/employee')
			  },
        {
          path: '/employee/detail',
          name: 'empDetail',
          component: () => import('@/views/Employee/detail')
        },
      	{
      		path: '/proTemplate',
      		name: 'proTemplate',
      		component: () => import('@/views/System/proTemplate')
      	},
      	{
      		path: '/empTemplate',
      		name: 'empTemplate',
      		component: () => import('@/views/System/empTemplate')
      	},
        {
          path: '/proTemplate/detail',
          name: 'proTempDetail',
          component: () => import('@/views/System/detail')
        },
        {
          path: '/empTemplate/detail',
          name: 'empTempDetail',
          component: () => import('@/views/System/detail')
        },
        {
          path: '/notify',
          name: 'notify',
          component: () => import('@/views/setting/notify')
        },
        {
          path: '/about',
          name: 'about',
          component: () => import('@/views/setting/echart-map')
        },
        {
          path: '/analysis',
          name: 'analysis',
          component: () => import('@/views/setting/analysis')
        }
      ]
    },
    {
    	path: '/login',
    	name: 'login',
    	component: () => import('@/views/Login/login')
   	},
  ]
})
